Memory management methods and systems

ABSTRACT

A method and an apparatus for determining a usage level of a memory device to notify a running application to perform memory reduction operations selected based on the memory usage level are described. An application calls APIs (Application Programming Interface) integrated with the application codes in the system to perform memory reduction operations. A memory usage level is determined according to a memory usage status received from the kernel of a system. A running application is associated with application priorities ranking multiple running applications statically or dynamically. Selecting memory reduction operations and notifying a running application are based on application priorities. Alternatively, a running application may determine a mode of operation to directly reduce memory usage in response to a notification for reducing memory usage without using API calls to other software.

This application is a continuation of co-pending U.S. application Ser.No. 16/162,040 filed Oct. 16, 2018, which is a continuation of U.S.application Ser. No. 15/362,538 filed Nov. 28, 2016, now issued as U.S.Pat. No. 10,127,090, which is a continuation of U.S. application Ser.No. 13/948,990 filed Jul. 23, 2013, now issued as U.S. Pat. No.9,535,771, which is a continuation of U.S. application Ser. No.12/909,751, filed Oct. 21, 2010, now issued as U.S. Pat. No. 8,516,198,which is a divisional of U.S. patent application Ser. No. 11/620,688,filed on Jan. 7, 2007, now issued as U.S. Pat. No. 7,827,358.

FIELD OF INVENTION

The present invention relates generally to memory management systems.More particularly, this invention relates to reducing memory usage formultiple applications.

BACKGROUND

As more and more services are becoming available for small or mobiledevices, the number of applications running in a single device hasincreased significantly. Usually, a small or mobile device is usedmostly for certain specific applications, while being equipped withgeneral purpose computing capabilities. For example, it is common tofind a mobile phone device that also runs a browser application, agaming application, and a music player application, etc. On the otherhand, a mobile video player device may run a gaming application and/oran email application in addition to a video application. Normally,multiple running applications in the same device compete with each otherby sharing the same memory space embedded inside the device.

Although the density of memory devices continues to increase, memorycapacities in small or mobile devices are still very limited as theirphysical sizes shrink at the same time. Traditionally, virtual memorytechnologies are employed to allow multiple applications to share alimited RAM (random access memory) using a secondary memory with a muchlarger capacity. However, the capacity in a secondary memory, such as aflash memory, for a small or mobile device may also be very limited.

Usually, a system monitors memory usage by multiple running applicationsto ensure availability of a required capacity of free memory. In somesystems, when memory usage reaches a critical level, the system takesmemory management actions to increase the size of free memory, such asactivating a garbage collection procedure to obtain allocated memoriesfrom applications which are no longer running. The system may alsotarget a selected application, such as by simply killing theapplication. Selecting a target application is usually based on the sizeor age of an application. As a result, the larger the size, the morelikely an application may be killed when memory usage is tight.

However, the priority among running applications in a small mobiledevice may not correspond to the size or age of an application. Inaddition, killing a running application may result in adverse userexperiences on the device as a whole. Furthermore, relying on memoryreduction by a single running application to reduce overall memory usagemay not be effective enough or may disrupt the running state of theapplication. Therefore, existing memory management approaches fall shortof addressing the challenges of serving multiple running applications ina small or mobile device with limited memory capacity.

SUMMARY OF THE DESCRIPTION

An embodiment of the present invention includes a method and apparatusthat determine a usage level of a memory device to notify a runningapplication to perform memory reduction operations selected based on thememory usage level. An application calls APIs (Application ProgrammingInterface) integrated in the system to perform memory reductionoperations. A memory usage level is determined according to a memoryusage status received from the kernel of a system. A running applicationis associated with application priorities ranking multiple runningapplications statically or dynamically. Selecting memory reductionoperations and notifying a running application may be based onapplication priorities.

In an alternative embodiment, an application may receive a notificationabout a memory usage level to reduce memory usage. The application maydetermine a mode of operation to directly reduce memory usage withoutusing API calls to other software.

Other features of the present invention will be apparent from theaccompanying drawings and from the detailed description that follows.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example and notlimitation in the figures of the accompanying drawings, in which likereferences indicate similar elements and in which:

FIG. 1 is a block diagram illustrating one embodiment of a system formemory management;

FIG. 2 is a flow diagram illustrating one embodiment of a process formemory management in accordance with the system of FIG. 1;

FIG. 3 illustrates an example of a usage level for a memory withwatermarks associated with corresponding memory reduction operations;

FIG. 4 is a block diagram illustrating an embodiment of a priority andoperation list in accordance with the system of FIG. 1;

FIG. 5 is a flow diagram illustrating one embodiment of a processperformed by a daemon for memory management in accordance with thesystem of FIG. 1;

FIG. 6 is a flow diagram illustrating an embodiment of a process thatselects applications according to application priorities to performmemory reduction operations in accordance with the system of FIG. 1;

FIG. 7 is a flow diagram illustrating an embodiment of a process toperform memory reduction operations in response to a notification inaccordance with the system of FIG. 1;

FIG. 8 is a block diagram illustrating another embodiment of a systemfor memory management;

FIG. 9 illustrates one example of a typical computer system which may beused in conjunction with the embodiments described herein.

DETAILED DESCRIPTION

A method and an apparatus for memory management are described herein. Inthe following description, numerous specific details are set forth toprovide thorough explanation of embodiments of the present invention. Itwill be apparent, however, to one skilled in the art, that embodimentsof the present invention may be practiced without these specificdetails. In other instances, well-known components, structures, andtechniques have not been shown in detail in order not to obscure theunderstanding of this description.

Reference in the specification to “one embodiment” or “an embodiment”means that a particular feature, structure, or characteristic describedin connection with the embodiment can be included in at least oneembodiment of the invention. The appearances of the phrase “in oneembodiment” in various places in the specification do not necessarilyall refer to the same embodiment.

The processes depicted in the figures that follow, are performed byprocessing logic that comprises hardware (e.g., circuitry, dedicatedlogic, etc.), software (such as is run on a general-purpose computersystem or a dedicated machine), or a combination of both. Although theprocesses are described below in terms of some sequential operations, itshould be appreciated that some of the operations described may beperformed in different order. Moreover, some operations may be performedin parallel rather than sequentially.

In one embodiment, a memory management may be designed to provide amemory management mechanism without virtual pages in an operating systemfor multiple applications to share a physical memory of limitedcapacity. When detecting a shortage of available physical memoryresources, a daemon or other software components may cause notificationsto be sent to running applications for performing memory reductionoperations. In response, notified applications may perform correspondingmemory reduction operations to increase the size of available physicalmemory. Collectively, the change of available physical memory size maybe significant to reduce or eliminate an immediate possibility of memoryshortage. In the mean time, most applications remain running withreduced memory usage without drastic impact on user experiences.

According to one embodiment, different notifications may be sent toselected or all running applications based on application prioritiesand/or a usage status of the memory. A usage status of the memory may bebased on a set of usage watermarks. In one embodiment, a runningapplication may be associated with an application priority according toan application priority list ranking the application among multipleapplications which may be running at the same time. For example, runningapplications may be prioritized based on the most recent active files orpages associated, the total physical memory occupied, and/or apredetermined application priority. A running application may beassociated with more than one application priorities according tomultiple application priority lists. In one embodiment, applicationswith high priorities may receive a notification to perform memoryreduction operations to yield partial cache memory occupied. While a lowpriority application may be asked to perform operations to yield all itsoccupied cache memory. Memory reduction operations may be performedthrough APIs (Application Programming Interfaces) integrated with anapplication.

FIG. 1 is a block diagram illustrating one embodiment of a system formemory management. In one embodiment, system 100 may be an operationsystem including a kernel 115 interfacing with a physical memory 117.The physical memory 117 may be a RAM (Random Access Memory), a flashmemory or other types of memory devices compatible with system 100. Eachrunning application, such as application-1 107 in an applicationframework 101 of the system 100, may be allocated a part of the physicalmemory 117 for its run-time use. An application may request/releasememory allocations through a memory management module 111. A memoryallocated for an application may be private to the application or sharedtogether with other applications. For example, in one embodiment,application-1 107 may be allocated with a private memory 1 119 and ashared memory 121, where the private memory 1 119 is used exclusivelyfor application-1 107 while the shared memory can be accessed by allapplications including application-1 107.

In one embodiment, the system 100 may include an application framework101 for supporting multiple running applications such as application-1,application-2, and application-n 127. A user interface module 109 may beintegrated with multiple running applications through the applicationframework 101 for an application to interface with a user 129 using thesystem 100. In one embodiment, the application framework 101 may includean application supervisor 105. The application supervisor 105 may run asa background process in the system 100. In one embodiment, a priorityand operation list 103 may be associated with the application supervisor105 as part of the application framework 101. The priority and operationlist 103 may be a database or a data structure storing information aboutapplication priorities. In one embodiment, a running application mayregister with the priority and operation list 103 when activated. Inanother embodiment, the application framework 101 may automaticallymonitor the set of running applications and updates the priority andoperation list 103 accordingly. A priority list ranking currentlyrunning applications may be dynamically updated by the applicationframework. In one embodiment, the priority and operation list 103 mayinclude a predetermined static priority list for critical applications.

The application supervisor 105, according to one embodiment, may receiveinformation about a usage level of the physical memory 117 from a daemonprocess 113. The application supervisor may send notification messagesto selected running applications according to the usage level received.In one embodiment, the notification message from the applicationsupervisor 105 may be associated with one or more memory reductionoperations based on the priority and operation list 103. Thenotification message may depend on the priority information associatedwith the target application based on the priority and operation list103. In one embodiment, the application supervisor 105 may dynamicallyupdate a priority list in the priority and operation list 103. Theapplication supervisor 105 may update a priority list in response toreceiving information about the memory usage level. In one embodiment, arunning application may perform memory reduction operations according tonotification messages received from the application supervisor 105 bycalling one or more APIs provided by the application framework 101. Arunning application such as application-1 107 may be integrated with anAPI library component 123 of the application framework 101. In oneembodiment, the API library 123 may include the APIs corresponding tomemory reduction operations.

In one embodiment, the daemon 113 may run as a background process in thesystem 100. The daemon may periodically send a request to the kernel 115for a current usage status of the physical memory 117. In oneembodiment, the kernel 115 may notify the daemon 113 about the currentusage status of the memory 117. The kernel 115 may send the daemon 113 ausage status whenever a change of the amount of available physicalmemory 117 exceeds a predetermined threshold since sending the previoususage status notification. In one embodiment, the kernel may notify thedaemon 113 with a current usage status of the physical memory 117 in aperiodical manner. The daemon 113 may determine a usage level based onthe received usage status for the physical memory 117. In oneembodiment, the daemon 113 may send a message about the determined usagelevel to the application supervisor 105. In another embodiment, thedaemon 113 may send a message including the usage status received fromkernel 115 to the application supervisor 105. The daemon 113 may sendmessage directly to a running application instead of the applicationsupervisor 105 based on the determined usage level.

FIG. 2 is a flow diagram illustrating one embodiment of a process formemory management in accordance with the system of FIG. 1. Processinglogic of the process 200 may determine a usage level of a memory atblock 201. The memory may be a memory device such as the physical memory117 of FIG. 1 that supports one or more running applications in asystem. In one embodiment, a usage level may be derived from a usagestatus of the memory device. A usage status may include private memoryallocations for each running application. A usage status may alsoinclude memory allocation for a shared memory. In one embodiment, ausage status may be based on a percentage of the total size of thememory device. Alternatively, a usage level may be determined based onthe usage status according to a predetermined set of watermarks of thetotal memory usage.

At block 203, according to one embodiment, processing logic of theprocess 200 may select memory reduction operations for a runningapplication based on a usage level. Each memory reduction operation maybe associated with one or more APIs from an API library integrated withthe application. In one embodiment, processing logic of the process 200may perform a memory reduction operation by an application calling theassociated APIs. The required memory reduction operations may beselected according to a usage level of the memory device supporting therunning application. In one embodiment, a selected memory reductionoperation may be optional or required for an application. The selectedmemory reduction operation may be required when the usage level is abovea predetermined watermark of memory usage of the memory device. In oneembodiment, processing logic of the process 200 may select a memoryreduction operation via an application calling an API.

At block 205, according to one embodiment, processing logic of theprocess 200 may instruct a running application to perform optionallyselected memory reduction operations. Processing logic of the process200 may send a notification message to the running application to callthe APIs associated with the memory reduction operations. In oneembodiment, the notification message may include a usage level of amemory. In another embodiment, the notification message may includecallbacks to the associated APIs. When the selected memory reductionoperation is optional, processing logic of the process 200 considersother factors for an application to determine whether to perform amemory reduction operation. In one embodiment, a background applicationmay be required to perform a memory reduction operation. Processinglogic of the process 200 may perform memory reductions operations via anapplication calling APIs by executing callbacks received from anotification. In one embodiment, processing logic of the process 200 mayidentify whether a memory reduction operation is optional during when anapplication calling an API. Subsequent to instructing applications toreduce the usage level of a memory at block 205, processing logic of theprocess 200 may determine a new usage level of memory again at block201.

FIG. 3 illustrates an example of a usage level for a memory withwatermarks associated with corresponding memory reduction operations. Inone embodiment, a watermark of a memory usage level 311 may represent apercentage of memory already in use with respect to the total availablememory space of a memory device. For example, watermark 313 may indicateno more memory space is available for any application. In oneembodiment, a memory usage level may be derived from a memory usagestatus received from a system kernel. The usage level of a memory maychange over time as the number of running applications accessing thememory increases or decreases. The usage level of a memory may alsochange as an application accessing the memory runs in different states.In one embodiment, an association may be predefined between a memoryusage level 311 and a set of memory reduction operations 323 based on aplurality of watermarks 325. A memory reduction operation may beperformed by a running application receiving a notification based on amemory usage level. In one embodiment, if the memory usage level may bebelow 50% watermark 321, no operation is needed for memory reduction. Ifthe memory usage level is identified to be greater than 50% 321 but lessthen 70% watermark 319, a running application may be notified to performmemory reduction operations such as closing opened windows, flushingcache memory used and/or alerting a user to conserve memory usage 307.In one embodiment, a user may be alerted with a pop up message asking auser to close opened windows no longer needed. When the memory usagelevel is identified to be between 70% watermark 319 and 80% watermark317, according to one embodiment, an application may be notified toperform memory reduction operations such as self archiving or hidingitself from a foreground application to a background application 305.Self archiving (freezing dry) may cause a running application to enterinto a hibernated state in a condensed format which requires much lessmemory space than required to support a current state of the runningapplication. In one embodiment, when the memory usage level isidentified to be between 80% watermark 317 and 90% watermark 315, anapplication may be notified to exit a system gracefully 303 includingallowing a user to save application data. When the memory usage level isidentified to be above watermark 90% 315, according to one embodiment,selected applications may be killed directly to reduce memory usagelevel 301. An application may be selected to be killed based on anassociated application priority. In one embodiment, a runningapplication associated with the lowest application priority based on apredetermine priority list may be selected to be killed.

FIG. 4 is a block diagram illustrating an embodiment of a priority andoperation list in accordance with the system of FIG. 1. The priority andoperation list 400 may include static lists and dynamically lists. Inone embodiment, a static list may be predetermined according to settingsof a system such as shown in FIG. 1. A dynamic list may be updatedduring the operation of a system. In one embodiment, static lists mayinclude a list of critical applications 427 and/or a list of memoryreduction operations 401. Critical applications may be, for example, aninternet web browser, an electronic mail application, or a music player,etc. A memory reduction operation may be sending alert messages 403 forusers to conserve memory usage, flushing a portion of cache memory 405currently in use by an application, flushing all cache memory 407currently in use by an application, hiding to a background applicationfrom a foreground application 409, freezing dry 411 by entering into ahibernated state in a condensed format, restarting an existingapplication 413, or exiting the system gracefully 429. These variousactions may be invoked by the application's calling of an API to performvarious operations such as flushing some or all of the application'scaches; hiding the application to the background; closing one or morewindows of the application; restarting the application; and/or “freezedrying” the application state for later restoration when the applicationis run again. In other embodiments, the application itself may performone or more of these actions or operations to reduce memory usagewithout calling an API.

In one embodiment, an application priority list 415 may be a dynamiclist in a priority and operation list 400. Dynamic lists may be updatedthrough an application framework such as shown in FIG. 1. In oneembodiment, dynamic lists may be updated by the application supervisor105 of FIG. 1. Updates to dynamic lists may occur in response toactivating an application and/or receiving a usage level of a memory byan application framework such as shown in FIG. 1. In one embodiment,periodic updates to dynamic lists may be scheduled according to a presetperiod. The application priority list 415 may include a ranking amongcurrently running applications according to whether a runningapplication is a critical application 417, a foreground application 419,a specific type of application such as a personal communicationapplication 421 or a background application 423. A personalcommunication application may be, for example, an instant messaging orSMS (Short Message Service) application. In one embodiment, specialtypes of applications may be designated according to a predeterminedstatic list in the priority and operation list 400. In one embodiment, adynamic priority list 425 may be based on recent active page associatedwith a running application. The more recent the time stamp of an activepage associated with a running application, according to one embodiment,the higher the corresponding priority may be in the priority list 425.

FIG. 5 is a flow diagram illustrating one embodiment of a process 500performed by a daemon for memory management in accordance with thesystem of FIG. 1. At block 501, according to one embodiment, processinglogic for process 500 may request a memory usage status from a systemkernel. Processing logic for process 500 may receive the memory usagestatus in response to the request or based on a message sent by thesystem kernel. The memory usage status may include private and sharedmemory allocation information for a running application. In oneembodiment, at block 503, processing logic for process 500 may determinea usage level of memory based on the received memory usage status fromthe system kernel. The usage level may be based on a comparison betweena sum of amount of memory allocated for running applications and amaximum available capacity of a memory device. In one embodiment,processing logic may determine whether the usage level of memory is toohigh at block 505. Processing logic for process 500 may determine ausage level of memory too high according to a set of watermarks, such asshown in FIG. 3. If the usage level is determined as being too high,processing logic for process 500 may proceed at block 507. Otherwise,processing logic returns at block 501. In one embodiment, the usagelevel of memory may be too high if exceeding a 50% watermark.

At block 507, according to one embodiment, processing logic for process500 notifies a running application to perform memory reductionoperations associated with the usage level of memory. The notificationfrom processing logic for process 500 may include the usage level ofmemory. Processing logic for process 500 may indirectly notify a runningapplication by sending a message including the usage level of memory toan application framework associated with the running application such asshown in FIG. 1. In one embodiment, the notification may be sent to allrunning applications. In another embodiment, the notification may besent to a selected set of running applications. The selection may bebased on application priority list as shown in FIG. 4. At block 509,according to one embodiment, processing logic of process 500 may receivea response from a running application notified to perform memoryreduction operations. In another embodiment, processing logic of process500 may receive a notification from a timer periodically at block 509.Processing logic of process 500 may receive a notification directly fromthe system kernel. Subsequent to receiving a response or a notificationat block 509, processing logic of process 500 may return back to block501.

FIG. 6 is a flow diagram illustrating an embodiment of a process 600that selects applications according to application priorities to performmemory reduction operations in accordance with the system of FIG. 1. Atblock 601, according to one embodiment, processing logic of process 600may receive a notification of a usage level of a memory device.Processing logic of process 600 may ignore the notification if the usagelevel is not high. In one embodiment, only notifications associated witha high usage level of memory may be received at block 601. At block 603,processing logic of process 600 may select one or more applicationscurrently running to reduce memory usage level. In one embodiment, theselection may be based on application priorities. A running applicationmay be associated with a priority based on an application priority liststored in a data structure such as shown in FIG. 4. In one embodiment, arunning application may be associated with more than one applicationpriority lists. Processing logic of process 600 may select oneapplication priority list to determine a priority of an applicationbased on the memory usage level. In one embodiment, processing logic ofprocess 600 may combine multiple application priority lists to determinea priority of an application. Processing logic of process 600 may assigna highest priority to a critical application such as shown in FIG. 4without considering other priority lists. In one embodiment, theselected applications may include a fixed number of the runningapplications associated with the lower priorities.

At block 605, according to one embodiment, processing logic of process600 determines a set of memory reduction operations for a selectedrunning application according to the memory usage level. A memoryreduction operation may be selected based on association with presetwatermarks of memory usage levels as shown in FIG. 3. In one embodiment,more than on memory reduction operations may be selected for a runningapplication. In another embodiment, one memory reduction operation maybe selected for a running application. An application may be assigned amemory reduction operation randomly selected from a group of operationsdetermined based on the memory usage level. In one embodiment,processing logic of process 600 may notify each selected application toperform assigned memory reduction operations by calling APIs at block607. The notification received by a selected application may includecallbacks to call APIs for performing memory reduction operations. Inanother embodiment, the notification may include the memory usage level.Processing logic of process 600 may notify a selected runningapplication according to a messaging mechanism of an applicationframework associated with the selected running application. At block609, according to one embodiment, processing logic of process 600 mayreceive acknowledgement messages from notified applications. Processinglogic of process 600 may proceed at block 601 after receiving allacknowledgement messages. In another embodiment, processing logic ofprocess 600 may return to block 601 after a preset period of time.

FIG. 7 is a flow diagram illustrating an embodiment of a process 700 toperform memory reduction operations in response to a notification inaccordance to the system of FIG. 1. At block 701, according to oneembodiment, processing logic of 700 may receive a notification toperform memory reduction operations associated with a usage level of amemory device. A memory reduction operation, for example, may beselected from the memory reduction operation list as shown in FIG. 4.The notification may include callbacks to APIs that cause processinglogic of process 700 to perform memory reduction operations. In oneembodiment, the notification may include a memory usage level.Processing logic of process 700 may determine an API in response to thenotification received at block 703. In one embodiment, the API may bedetermined based on the memory usage level associated with thenotification. In another embodiment, determining an API may be embeddedin the callbacks included in the notification. Processing logic ofprocess 700 may determine not to perform memory reduction operations atblock 703. In one embodiment, processing logic of process 700 may call adefault API that determines an API to perform memory reductionoperations. At block 705, according to one embodiment, processing logicof process 7000 may call the API determined at block 703 to performassociated memory reduction operations.

Alternatively, in another embodiment, processing logic of process 700may determine a mode of operation at block 703 based on the notificationreceived. A mode of operation may be to minimize memory usage.Processing logic of process 700 may change the mode of operation atblock 705 accordingly. In one embodiment, processing logic of process700 may deallocate a portion of memory storing a value at a memorylocation according to a mode of operation. The value may be a result ofan earlier execution of a set of instructions by processing logic of theprocess 700. The value may be a computed value. Alternatively, the valuemay be fetched remotely. In one embodiment, processing logic of theprocess 700 may repeat executing the same set of instructions to obtainthe same value when referenced based on a mode of operation to minimizememory usage. Processing logic of the process 700 may fetch from amemory location storing the value when referenced according to anothermode of operation to maximize speed.

FIG. 8 is a block diagram illustrating another embodiment of a systemfor memory management. In one embodiment, the system 800 may include adaemon 803 optionally associated with a priority and operation list 803.The daemon 803 may be running as a background process in the system 800.The priority and operation list 803 may be a database or a datastructure maintained by an application framework 801. The priority andoperation list 803 may include preset static list of memory reductionoperations and dynamically updated lists of running applications such asshown in FIG. 4. In one embodiment, the daemon 803 may requestapplication priority information from the kernel process 815 for arunning application in the application framework 801. In anotherembodiment, a running application such as application-1 807 may beintegrated with an API library 823 of the application framework 801. Inone embodiment, the API library 823 may include a selection APIassociated with application priorities. The API library 823 may includeAPIs for performing memory reduction operations as listed in thepriority and operation list 803. The change of the mode of operation maybe performed either by calling an API to reduce memory usage or by theapplication itself changing the mode without calling an API.

In one embodiment, the daemon 803 may be a process receiving memoryusage status from the system kernel 815. The daemon 803 may determine amemory usage level based on the memory usage status received. In oneembodiment, the daemon may send notifications including the determinedmemory usage level to all applications to perform memory reductionoperations by calling the selection API of the API library 823. Eachrunning application calling the selection API may determine to performone or more memory reduction operations based on the memory usage level.A running application may perform memory reduction operations by callingAPIs associated with the memory reduction operations. A runningapplication may determine not to perform a memory reduction operationaccording to an associated application priority and the memory usagelevel. In another embodiment, the daemon 813 may select one or morerunning applications to perform memory reduction operations according toapplication priorities from the priority and operation list 803. Thedaemon may select one or more memory reduction operations for a selectedapplication according to the list of memory reduction operations in thepriority and operation list 803.

FIG. 9 shows one example of a computer system which may be used with oneembodiment the present invention. For example, the system 900 may beimplemented as a part of the systems shown in FIGS. 1 and 8. Note thatwhile FIG. 9 illustrates various components of a computer system, it isnot intended to represent any particular architecture or manner ofinterconnecting the components as such details are not germane to thepresent invention. It will also be appreciated that network computersand other data processing systems which have fewer components or perhapsmore components may also be used with the present invention.

As shown in FIG. 9, the computer system 901, which is a form of a dataprocessing system, includes a bus 902 which is coupled to amicroprocessor(s) 903 and a ROM (Read Only Memory) 907 and volatile RAM905 and a non-volatile memory 906. The microprocessor 903 may retrievethe instructions from the memories 907, 905, 906 and execute theinstructions to perform operations described above. The bus 902interconnects these various components together and also interconnectsthese components 903, 907, 905, and 906 to a display controller anddisplay device 908 and to peripheral devices such as input/output (I/O)devices which may be mice, keyboards, modems, network interfaces,printers and other devices which are well known in the art. Typically,the input/output devices 910 are coupled to the system throughinput/output controllers 909. The volatile RAM (Random Access Memory)905 is typically implemented as dynamic RAM (DRAM) which requires powercontinually in order to refresh or maintain the data in the memory.

The mass storage (or non-volatile memory 906) is typically a magnetichard drive or a magnetic optical drive or an optical drive or a DVD RAMor a flash memory or other types of memory systems which maintain data(e.g. large amounts of data) even after power is removed from thesystem. Typically, the mass storage 906 will also be a random accessmemory although this is not required. While FIG. 9 shows that the massstorage 906 is a local device coupled directly to the rest of thecomponents in the data processing system, it will be appreciated thatthe present invention may utilize a non-volatile memory which is remotefrom the system, such as a network storage device which is coupled tothe data processing system through a network interface such as a modemor Ethernet interface or wireless networking interface. The bus 902 mayinclude one or more buses connected to each other through variousbridges, controllers and/or adapters as is well known in the art.

Portions of what was described above may be implemented with logiccircuitry such as a dedicated logic circuit or with a microcontroller orother form of processing core that executes program code instructions.Thus processes taught by the discussion above may be performed withprogram code such as machine-executable instructions that cause amachine that executes these instructions to perform certain functions.In this context, a “machine” may be a machine that converts intermediateform (or “abstract”) instructions into processor specific instructions(e.g., an abstract execution environment such as a “virtual machine”(e.g., a Java Virtual Machine), an interpreter, a Common LanguageRuntime, a high-level language virtual machine, etc.), and/or,electronic circuitry disposed on a semiconductor chip (e.g., “logiccircuitry” implemented with transistors) designed to executeinstructions such as a general-purpose processor and/or aspecial-purpose processor. Processes taught by the discussion above mayalso be performed by (in the alternative to a machine or in combinationwith a machine) electronic circuitry designed to perform the processes(or a portion thereof) without the execution of program code.

An article of manufacture may be used to store program code. An articleof manufacture that stores program code may be embodied as, but is notlimited to, one or more memories (e.g., one or more flash memories,random access memories (static, dynamic or other)), optical disks,CD-ROMs, DVD ROMs, EPROMs, EEPROMs, magnetic or optical cards or othertype of machine-readable media suitable for storing electronicinstructions. Program code may also be downloaded from a remote computer(e.g., a server) to a requesting computer (e.g., a client) by way ofdata signals embodied in a propagation medium (e.g., via a communicationlink (e.g., a network connection)).

The preceding detailed descriptions are presented in terms of algorithmsand symbolic representations of operations on data bits within acomputer memory. These algorithmic descriptions and representations arethe tools used by those skilled in the data processing arts to mosteffectively convey the substance of their work to others skilled in theart. An algorithm is here, and generally, conceived to be aself-consistent sequence of operations leading to a desired result. Theoperations are those requiring physical manipulations of physicalquantities. Usually, though not necessarily, these quantities take theform of electrical or magnetic signals capable of being stored,transferred, combined, compared, and otherwise manipulated. It hasproven convenient at times, principally for reasons of common usage, torefer to these signals as bits, values, elements, symbols, characters,terms, numbers, or the like.

It should be kept in mind, however, that all of these and similar termsare to be associated with the appropriate physical quantities and aremerely convenient labels applied to these quantities. Unlessspecifically stated otherwise as apparent from the above discussion, itis appreciated that throughout the description, discussions utilizingterms such as “processing” or “computing” or “calculating” or“determining” or “displaying” or the like, refer to the action andprocesses of a computer system, or similar electronic computing device,that manipulates and transforms data represented as physical(electronic) quantities within the computer system's registers andmemories into other data similarly represented as physical quantitieswithin the computer system memories or registers or other suchinformation storage, transmission or display devices.

The present invention also relates to an apparatus for performing theoperations described herein. This apparatus may be specially constructedfor the required purpose, or it may comprise a general-purpose computerselectively activated or reconfigured by a computer program stored inthe computer. Such a computer program may be stored in a computerreadable storage medium, such as, but is not limited to, any type ofdisk including floppy disks, optical disks, CD-ROMs, andmagnetic-optical disks, read-only memories (ROMs), RAMs, EPROMs,EEPROMs, magnetic or optical cards, or any type of media suitable forstoring electronic instructions, and each coupled to a computer systembus.

The processes and displays presented herein are not inherently relatedto any particular computer or other apparatus. Various general-purposesystems may be used with programs in accordance with the teachingsherein, or it may prove convenient to construct a more specializedapparatus to perform the operations described. The required structurefor a variety of these systems will be evident from the descriptionbelow. In addition, the present invention is not described withreference to any particular programming language. It will be appreciatedthat a variety of programming languages may be used to implement theteachings of the invention as described herein.

The foregoing discussion merely describes some exemplary embodiments ofthe present invention. One skilled in the art will readily recognizefrom such discussion, the accompanying drawings and the claims thatvarious modifications can be made without departing from the spirit andscope of the invention.

1-73. (canceled)
 74. A machine readable non-transitory storage mediumhaving instructions which, when executed by a machine, cause the machineto perform a method comprising: determining a usage level of a memory ina device, the usage level based on an amount of memory already in use,wherein the usage level is one of a plurality of usage levels; selectingone or more applications from a set of applications which are using thememory; notifying the selected one or more applications of the usagelevel via an API (Application Programming Interface) to allow each ofthe selected one or more applications to perform a memory reduction inresponse to receiving the notification; wherein the plurality of usagelevels includes at least some usage levels representing different levelsof requested memory reduction.
 75. The medium as in claim 74 wherein theselected one or more applications are selected based on a recency basedpriority list which is dynamic and wherein the memory reductionoperation is optional and wherein the notifying includes providing anotification that includes the usage level and using a callback andwherein the machine uses a memory management system that operateswithout using virtual pages.
 76. The medium as in claim 75 wherein thememory reduction operation includes archiving a state of an applicationin a condensed format.
 77. The medium as in claim 74 wherein theselected one or more applications are selected based on a dynamicpriority list and wherein the usage level is a numerical value which isrelated to the amount of memory already in use that is determined priorto the notifying.
 78. The medium as in claim 74 wherein a first group ofthe selected one or more applications are notified with a firstnotification that specifies the first usage level and a second group ofthe selected one or more applications are notified with a secondnotification that specifies the second usage level.
 79. The medium as inclaim 78 wherein the first notification includes a callback to call anAPI and the second notification includes a callback to call an API. 80.The medium as in claim 79 wherein the memory reduction operation isoptional.
 81. The medium as in claim 80 wherein the memory reductionoperation includes archiving a state of an application in a condensedformat.
 82. The medium as in claim 74 wherein different usage levelsrepresent different ranges of memory in use.
 83. The medium as in claim82 wherein the machine uses a memory management system that operateswithout using virtual pages.
 84. The medium as in claim 74 wherein thedynamic priority list includes a set of critical user applications thathave a static, high priority.
 85. A machine implemented methodcomprising: determining a usage level of a memory in a device, the usagelevel based on an amount of memory already in use, wherein the usagelevel is one of a plurality of usage levels; selecting one or moreapplications from a set of applications which are using the memory;notifying the selected one or more applications of the usage level viaan API (Application Programming Interface) to allow each of the selectedone or more applications to perform a memory reduction in response toreceiving the notification; the plurality of usage levels includes atleast some usage levels representing different levels of requestedmemory reduction.
 86. The method as in claim 85 wherein the selected oneor more applications are selected based on a recency based priority listwhich is dynamic and wherein the memory reduction operation is optionaland wherein the notifying includes providing a notification thatincludes the usage level and using a callback and wherein the machineuses a memory management system that operates without using virtualpages.
 87. The method as in claim 86 wherein the memory reductionoperation includes archiving a state of an application in a condensedformat.
 88. The method as in claim 85 wherein the selected one or moreapplications are selected based on a dynamic priority list and whereinthe usage level is a numerical value which is related to the amount ofmemory already in use that is determined prior to the notifying.
 89. Themethod as in claim 85 wherein a first group of the selected one or moreapplications are notified with a first notification that specifies thefirst usage level and a second group of the selected one or moreapplications are notified with a second notification that specifies thesecond usage level.
 90. The method as in claim 89 wherein the firstnotification includes a callback to call an API and the secondnotification includes a callback to call an API.
 91. The method as inclaim 90 wherein the memory reduction operation is optional.
 92. Themethod as in claim 85 wherein different usage levels represent differentamounts of memory in use.
 93. The method as in claim 85 wherein themachine uses a memory management system that operates without usingvirtual pages.